import com.google.common.hash.BloomFilter;
import com.google.common.hash.Funnels;

public class TestBloomFilter {

    private static int total = 1000000;

    private  static BloomFilter bloomFilter = BloomFilter.create(Funnels.integerFunnel(), total, 0.0001);


    public static void main(String[] args) {
        for(int i = 0; i < total; i++){
            bloomFilter.put(i);
        }

        for(int i = 0; i< total; i++){
            if(!bloomFilter.mightContain(i)){
                System.out.println("有逃脱~~~");
            }
        }

        int count = 0;
        for(int i = total; i< total + 1000; i++){
            if(bloomFilter.mightContain(i)){
                count ++;
            }
        }
        System.out.println("误伤的数量 : " + count);
    }
}
